package daoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import dao.AllKnowDao;
import pojo.AllKnow;
import pojo.Message;
import utils.DruidUtils;

public class AllKnowDaoImpl implements AllKnowDao{

	@Override
	public AllKnow getAllKnowDetails(String akid) {
		Connection conn = DruidUtils.getConnection();
		String sql = "select * from allKnow where akid="+"'"+akid+"'";
		AllKnow ak = new AllKnow();
		try {
			PreparedStatement pre = conn.prepareStatement(sql);
			//pre.setString(1, akid);
			//System.out.println(sql);
			ResultSet res = pre.executeQuery();
			while(res.next()) {
				ak.setAkid(res.getString("akid"));
				ak.setAkContent(res.getString("akContent"));
				

			}
			res.close();
			pre.close();
			conn.close();
			
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return ak;
	}

}
